<!-- Page header -->
<div class="page-header d-print-none">
  <div class="container-xl">
    <div class="row g-2 align-items-center">
      <div class="col-8">
        <!-- 页面标题 -->
        <h2 class="page-title">
          首页 - 职位列表
        </h2>
        <div class="text-muted mt-1 bit-paginator-jobs-text"></div>
      </div>
      <!-- 搜索框 -->
      <div class="col-4">
        <div class="input-group">
          <input type="text" class="form-control" placeholder="请输入关键字..." id="index-search-job-keyword">
          <!-- 宽屏 -->
          <button class="btn btn-outline-primary d-none d-sm-inline-block index-search-job" type="button">
            <svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="2"  stroke-linecap="round"  stroke-linejoin="round"  class="icon icon-tabler icons-tabler-outline icon-tabler-search"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" /><path d="M21 21l-6 -6" /></svg>
            <span>搜索</span>
          </button>
          <!-- 窄屏 -->
          <button class="btn btn-outline-primary d-sm-none btn-icon index-search-job" type="button">
            <svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="2"  stroke-linecap="round"  stroke-linejoin="round"  class="icon icon-tabler icons-tabler-outline icon-tabler-search"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" /><path d="M21 21l-6 -6" /></svg>
          </button>
        </div>
      </div>
    </div>
  </div>
</div>
<!-- Page body -->
<div class="page-body">
  <div class="container-xl">
    <div class="row justify-content-center">
      <!-- 显示列表的宽度 -->
      <div class="col-12">
        <div class="row row-cards">
          <div class="space-y" id="index-jobs-items-body">
            <!-- 一行开始 -->
            <!-- <div class="card">
              <div class="row g-0 align-items-center">
                <div class="col-auto">
                  <div class="card-body">
                    <div class="avatar avatar-md" style="background-image: url(./static/jobs/job-1.png)"></div>
                  </div>
                </div>
                <div class="col">
                  <div class="card-body ps-0">
                    <div class="row">
                      <div class="col">
                        <h3 class="mb-0"><a href="javascript:void(0);" class="opt-job-title">Frontend Web Engineer</a></h3>
                      </div>
                      <div class="col-auto fs-3 text-blue"><svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="2"  stroke-linecap="round"  stroke-linejoin="round"  class="icon icon-tabler icons-tabler-outline icon-tabler-report-money"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2" /><path d="M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z" /><path d="M14 11h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3h-2.5" /><path d="M12 17v1m0 -8v1" /></svg>
                        <strong>140,000</strong> - <strong>180,000</strong>
                      </div>
                    </div>
                    <div class="row">
                      <div class="col-md">
                        <div class="mt-3 list-inline list-inline-dots mb-0 text-muted">
                          <div class="list-inline-item">
                            <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-user" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                              <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                              <path d="M12 7m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"></path>
                              <path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path>
                           </svg>
                           小比特
                          </div>
                          <div class="list-inline-item">
                            <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock-edit" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                              <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                              <path d="M21 12a9 9 0 1 0 -9.972 8.948c.32 .034 .644 .052 .972 .052"></path>
                              <path d="M12 7v5l2 2"></path>
                              <path d="M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39z"></path>
                           </svg>
                            2023-02-22 15:36:23
                          </div>
                        </div>
                      </div>
                      <div class="col-md-auto">
                        <div class="mt-3 badges">
                            <ul class="list-inline list-inline-dots mb-0">
                              <li class="list-inline-item">
                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-eye" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                                  <path d="M12 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path>
                                  <path d="M22 12c-2.667 4.667 -6 7 -10 7s-7.333 -2.333 -10 -7c2.667 -4.667 6 -7 10 -7s7.333 2.333 10 7"></path>
                               </svg>
                                 1006
                              </li>
                              <li class="list-inline-item">
                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-heart" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                                  <path d="M19.5 12.572l-7.5 7.428l-7.5 -7.428a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572"></path>
                                </svg>
                                 2008
                              </li>
                              <li class="list-inline-item">
                                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-message-circle" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                                  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                                  <path d="M3 20l1.3 -3.9a9 8 0 1 1 3.4 2.9l-4.7 1"></path>
                                  <path d="M12 12l0 .01"></path>
                                  <path d="M8 12l0 .01"></path>
                                  <path d="M16 12l0 .01"></path>
                               </svg>
                                 3006
                              </li>
                            </ul>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-auto" style="margin-right: 1em;">
                  <div class="dropdown">
                    <a href="javascript:void(0);" class="btn-action" data-bs-toggle="dropdown" aria-expanded="false">
                      <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path></svg>
                    </a>
                    <div class="dropdown-menu dropdown-menu-end">
                      <a href="javascript:void(0);" class="dropdown-item opt-send-resume">
                        <svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="2"  stroke-linecap="round"  stroke-linejoin="round"  class="icon icon-tabler icons-tabler-outline icon-tabler-send"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 14l11 -11" /><path d="M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5" /></svg> 
                        &nbsp;投简历
                      </a>
                      <a href="javascript:void(0);" class="dropdown-item opt-add-favorite">
                        <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-heart" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
                          <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
                          <path d="M19.5 12.572l-7.5 7.428l-7.5 -7.428a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572"></path>
                        </svg>
                         &nbsp;感兴趣
                      </a>
                    </div>
                  </div>
                </div>
              </div>
            </div> -->
          </div>
        </div>

      </div>
    </div>
    <!-- 分页 -->
    <div class="row mt-4">
      <div class="d-flex align-items-center">
        <p class="m-0 text-muted bit-paginator-jobs-text"></p>
        <ul class="bit-paginator-jobs pagination m-0 ms-auto"></ul>
      </div>
    </div>
  </div>
  <!-- 正文 结束 -->
</div>

<script>
// 页面处理
$(function () {
  // 记录当前页号
  let cuuurentJobPageNum = 1;
  // 加载职位列表
  function loadJobList(pageNum) {
    // 请求职位列表
    let sendData = {
      pageNum : pageNum,
      pageSize : pageSize,
      title : $('#index-search-job-keyword').val()
    };

    // 发送请求
    $.ajax({
      type: 'get',
      url : 'job/indexPages',
      contentType: 'application/x-www-form-urlencoded',
      data : sendData,
      success : function (respData) {
        // 失败
        if (respData.code != 0) {
          // 提示
          $.toast({
            heading: '提示',
            text: respData.message,
            icon: 'info'
          });
          return;
        }
        // 成功构建页面
        buildJobList(respData.data)
      }
    });
  }

  // 第一次加载页面
  loadJobList(cuuurentJobPageNum);

  // 构建职位列表
  function buildJobList(data) {
    // 清空内容区
    $('#index-jobs-items-body').html('');
    // 没有记录
    if (data.rows.length == 0) {
      $('#index-jobs-items-body').html('<h3>没有职位记录</h3>');
      $('.bit-paginator-jobs-text').html('');
      $('.bit-paginator-jobs').html('');
      return;
    }
    // 遍历结果开始构建
    data.rows.forEach(job => {
      // 发布者头像
      if (!job.publisher.avatarUrl) {
        job.publisher.avatarUrl = avatarUrl
      }
      // 最高价与最低价
      let priceHtml;
      if (!job.rewardLower || !job.rewardUpper) {
        priceHtml = '<strong>薪资面议</strong>'
      } else {
        priceHtml = ' <strong>' + job.rewardLower + '</strong> - <strong>' + job.rewardUpper + '</strong> '
      }
      // 一行记录
      let jobRowHtmlStr = '<div class="card">' +
        ' <div class="row g-0 align-items-center"> ' +
        ' <div class="col-auto"> ' +
        ' <div class="card-body"> ' +
        ' <div class="avatar avatar-md" style="background-image: url(' + job.publisher.avatarUrl + ')"></div> ' +
        ' </div> ' +
        ' </div> ' +
        ' <div class="col"> ' +
        ' <div class="card-body ps-0"> ' +
        ' <div class="row"> ' +
        ' <div class="col"> ' +
        ' <h3 class="mb-0"><a href="javascript:void(0);" class="index-job-list-title">' + job.title + '</a></h3> ' +
        ' </div> ' +
        ' <div class="col-auto fs-3 text-blue"><svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="2"  stroke-linecap="round"  stroke-linejoin="round"  class="icon icon-tabler icons-tabler-outline icon-tabler-report-money"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2" /><path d="M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z" /><path d="M14 11h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3h-2.5" /><path d="M12 17v1m0 -8v1" /></svg> ' +
        priceHtml +
        ' </div> ' +
        ' </div> ' +
        ' <div class="row"> ' +
        ' <div class="col-md"> ' +
        ' <div class="mt-3 list-inline list-inline-dots mb-0 text-muted"> ' +
        ' <div class="list-inline-item"> ' +
        ' <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-user" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> ' +
        ' <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> ' +
        ' <path d="M12 7m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"></path> ' +
        ' <path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path> ' +
        ' </svg> ' +
        job.publisher.name +
        ' </div> ' +
        ' <div class="list-inline-item"> ' +
        ' <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock-edit" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> ' +
        ' <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> ' +
        ' <path d="M21 12a9 9 0 1 0 -9.972 8.948c.32 .034 .644 .052 .972 .052"></path> ' +
        ' <path d="M12 7v5l2 2"></path> ' +
        ' <path d="M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39z"></path> ' +
        ' </svg> ' +
        job.createTime +
        ' </div> ' +
        ' </div> ' +
        ' </div> ' +
        ' <div class="col-md-auto"> ' +
        ' <div class="mt-3 badges"> ' +
        ' <ul class="list-inline list-inline-dots mb-0"> ' +
        ' <li class="list-inline-item"> ' +
        '   <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-eye" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> ' +
        '     <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> ' +
        '     <path d="M12 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path> ' +
        '     <path d="M22 12c-2.667 4.667 -6 7 -10 7s-7.333 -2.333 -10 -7c2.667 -4.667 6 -7 10 -7s7.333 2.333 10 7"></path> ' +
        '   </svg> ' +
        job.visitCount +
        ' </li> ' +
        ' <li class="list-inline-item"> ' +
        '   <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-heart" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> ' +
        '     <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> ' +
        '     <path d="M19.5 12.572l-7.5 7.428l-7.5 -7.428a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572"></path> ' +
        '   </svg> ' +
        job.favoriteCount +
        ' </li> ' +
        ' <li class="list-inline-item"> ' +
        '   <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-message-circle" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> ' +
        '     <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> ' +
        '     <path d="M3 20l1.3 -3.9a9 8 0 1 1 3.4 2.9l-4.7 1"></path> ' +
        '     <path d="M12 12l0 .01"></path> ' +
        '     <path d="M8 12l0 .01"></path> ' +
        '     <path d="M16 12l0 .01"></path> ' +
        '   </svg> ' +
        job.receiveCount +
        ' </li> ' +
        ' </ul> ' +
        ' </div> ' +
        ' </div> ' +
        ' </div> ' +
        ' </div> ' +
        ' </div> ' +
        ' <div class="col-auto" style="margin-right: 1em;"> ' +
        ' <div class="dropdown"> ' +
        ' <a href="javascript:void(0);" class="btn-action" data-bs-toggle="dropdown" aria-expanded="false"> ' +
        ' <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path></svg> ' +
        ' </a> ' +
        ' <div class="dropdown-menu dropdown-menu-end"> ' +
        ' <a href="javascript:void(0);" class="dropdown-item opt-send-resume"> ' +
        ' <svg  xmlns="http://www.w3.org/2000/svg"  width="24"  height="24"  viewBox="0 0 24 24"  fill="none"  stroke="currentColor"  stroke-width="2"  stroke-linecap="round"  stroke-linejoin="round"  class="icon icon-tabler icons-tabler-outline icon-tabler-send"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 14l11 -11" /><path d="M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5" /></svg>  ' +
        ' &nbsp;投简历 ' +
        ' </a> ' +
        ' <a href="javascript:void(0);" class="dropdown-item opt-add-favorite"> ' +
        ' <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-heart" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> ' +
        ' <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> ' +
        ' <path d="M19.5 12.572l-7.5 7.428l-7.5 -7.428a5 5 0 1 1 7.5 -6.566a5 5 0 1 1 7.5 6.572"></path> ' +
        ' </svg> ' +
        ' &nbsp;感兴趣 ' +
        ' </a> ' +
        ' </div> ' +
        ' </div> ' +
        ' </div> ' +
        ' </div> ' +
        ' </div>';
        // 转化为jQuery对象
        let jobRowEl = $(jobRowHtmlStr);
        // 绑定事件
        // 详情
        jobRowEl.find('.index-job-list-title').click(function () {
          // 当前访问的职位Id
          currentJobId = job.id;
          // 加载编辑页
          $('#bit-page-content').load('job_details.html');
        });
        // 投简历
        let sendResumeEL = jobRowEl.find('.opt-send-resume');
          sendResumeEL.click(function() {
          sendResume(job.id)
        });
        // 加收藏
        let favoriteEL = jobRowEl.find('.opt-add-favorite');
          favoriteEL.click(function() {
          addFavorite(job.id)
        });
        // 追加到页面
        $('#index-jobs-items-body').append(jobRowEl);
    });
    // 显示分页
    buildJobPaginator(data);
  }
  // 分页显示
  function buildJobPaginator (data) {
    $('.bit-paginator-jobs').jqPaginator({
      totalPages: data.totalPage,
      visiblePages: 10,
      currentPage: data.pageNum,
      first: '<li class="page-item first"><a class="page-link" href="javascript:void(0)"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevrons-left"><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path d="M11 7l-5 5l5 5" /><path d="M17 7l-5 5l5 5" /></svg></a></li>',
      prev: '<li class="page-item prev"><a class="page-link" href="javascript:void(0)"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left"><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path d="M15 6l-6 6l6 6" /></svg></a></li>',
      next: '<li class="page-item next"><a class="page-link" href="javascript:void(0)"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right"><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path d="M9 6l6 6l-6 6" /></svg></a></li>',
      last: '<li class="page-item last"><a class="page-link" href="javascript:void(0)"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevrons-right"><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path d="M7 7l5 5l-5 5" /><path d="M13 7l5 5l-5 5" /></svg></a></li>',
      page: '<li class="page-item page"><a class="page-link" href="javascript:void(0)">{{page}}</a></li>',
      onPageChange: function (pageNum, type) {
          $('.bit-paginator-jobs-text').html('当前显示第 ' + pageNum + ' / ' + data.totalPage + ' 页');
          // 当前访问的页号
          cuuurentJobPageNum = pageNum;
          // 加载职位列表
          if (type == 'change') {
            loadJobList(pageNum);
          }
          
      }
    });
  }

  // 发送简历
  function sendResume(jobId) {
    if (!jobId) {
      return;
    }
    // 构造数据
    let sendData = {
      jobId : jobId
    };
    // 发送AJAX请求
    $.ajax({
      type : 'post',
      url : '/deliver/add',
      contentType: 'application/x-www-form-urlencoded',
      data : sendData,
      success : function (respData) {
        if (respData.code == 0) {
          // 提示
          $.toast({
            heading: '提示',
            text: '投递成功，请在个人中心中跟进.',
            icon: 'success'
          });
        } else {
          $.toast({
            heading: '失败',
            text: respData.message,
            icon: 'info'
          });
        }
      }
    });
  }

  // 添加收藏
  function addFavorite(jobId) {
    if (!jobId) {
      return;
    }
    // 发送AJAX请求
    $.ajax({
      type : 'put',
      url : '/favorite/add/' + jobId,
      success : function (respData) {
        if (respData.code == 0) {
          // 提示
          $.toast({
            heading: '提示',
            text: '收藏成功, 请在个人中心中查看.',
            icon: 'success'
          });
        } else {
          $.toast({
            heading: '失败',
            text: respData.message,
            icon: 'info'
          });
        }
      }
    });
  }

  // 搜索按钮绑定事件
  $('.index-search-job').click(function () {
    // 设置起始页号为1
    cuuurentJobPageNum = 1;
    // 开始搜索
    loadJobList(cuuurentJobPageNum);
  });
});

</script>